/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.saar.penguin.give2.server.alert;

import de.saar.penguin.give2.server.BigBrother;
import de.saar.penguin.give2.server.DescribedObject;
import de.saar.penguin.give2.server.Instruction;
import de.saar.penguin.give2.server.SaarNlgSystem;

/**
 *
 * @author koller
 */
public class ObjectBecomesVisibleAlert extends Alert {
    private DescribedObject targetObject;

    public ObjectBecomesVisibleAlert(SaarNlgSystem nlg, DescribedObject targetObject) {
        super(nlg);
        this.targetObject = targetObject;
    }
    

    @Override
    public boolean isActivated(BigBrother bb) {
        return (nlg.visible.contains(targetObject.getId()));
    }

    @Override
    public Instruction getInstruction() {
        return nlg.instructionGenerator.createInstruction(nlg.visible);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ObjectBecomesVisibleAlert other = (ObjectBecomesVisibleAlert) obj;
        if (this.targetObject != other.targetObject && (this.targetObject == null || !this.targetObject.equals(other.targetObject))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 11 * hash + (this.targetObject != null ? this.targetObject.hashCode() : 0);
        return hash;
    }

    
}
